<template>
  <el-container>
    <!-- 头部 -->
    <el-header>
      <div class="header-logo" style="cursor: pointer">
        <span>依云商城后台管理</span>
      </div>
      <div class="btn-wrap">
        <span style="margin: 10px">欢迎您 , admin</span>
        <button
          type="button"
          class="el-button el-button--warning el-button--medium"
        >
          <span>注销登录</span>
        </button>
        <button
          type="button"
          class="el-button el-button--info el-button--medium"
          @click="onChange"
        >
          <i class="el-icon-setting"></i>
        </button>
      </div>
    </el-header>

    <el-container>
      <!-- 侧边栏 -->
      <el-aside width="200px">
        <el-radio-group v-model="isCollapse">
          <el-radio-button :label="false"
            >展开</el-radio-button
          >
          <el-radio-button :label="true">收起</el-radio-button>
        </el-radio-group>
        <el-menu
          default-active="1-4-1"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          :collapse="isCollapse"
          router
        >

          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-user-solid"></i>
              <span slot="title">用户管理</span>
            </template>
            <el-menu-item index="/NaviGation/UserAdmin/UserList" class="el-icon-menu">用户列表</el-menu-item>
          </el-submenu>

          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-key"></i>
              <span slot="title">权限管理</span>
            </template>
            <el-menu-item index="/NaviGation/JuAdmin/RoleList" class="el-icon-menu">角色列表</el-menu-item>
            <el-menu-item index="/NaviGation/JuAdmin/JuList" class="el-icon-menu">权限列表</el-menu-item>
          </el-submenu>

          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-shopping-bag-1"></i>
              <span slot="title">商品管理</span>
            </template>
            <el-menu-item index="/NaviGation/ComAdmin/ComList" class="el-icon-menu">商品列表</el-menu-item>
            <el-menu-item index="/NaviGation/ComAdmin/ParaMeter" class="el-icon-menu">分类参数</el-menu-item>
            <el-menu-item index="/NaviGation/ComAdmin/ComClass" class="el-icon-menu">商品分类</el-menu-item>
          </el-submenu>

          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-shopping-bag-1"></i>
              <span slot="title">订单管理</span>
            </template>
            <el-menu-item index="/NaviGation/OrderAdmin/OrderList" class="el-icon-menu">订单管理</el-menu-item>
          </el-submenu>

          <el-submenu index="5">
            <template slot="title">
              <i class="el-icon-s-marketing"></i>
              <span slot="title">数据统计</span>
            </template>
            <el-menu-item index="/NaviGation/DataAdmin/DataStats" class="el-icon-menu">数据报表</el-menu-item>
          </el-submenu>



        </el-menu>
      </el-aside>
      <!-- 内容区域 -->
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "NavGation",
  data() {
    return {
      isCollapse: false,
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    onChange(){
      this.$router.push('/NaviGation/TackView')
    }
  },
  async mounted() {
    let res1=await this.$store.state.up.menu;
    console.log(res1);
    this.isCollapse=res1
  },
};
</script>

<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 198px;
  min-height: 400px;
}
.el-main{
  padding: 20px;
  background: rgb(246, 246, 246);
}
.el-header,
.el-footer {
  background-image: linear-gradient(#00bcd4, #2196f3);
  color: #fff;
  text-align: center;
  line-height: 8vh;
  height: 8vh !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-logo {
  height: 100%;
}

.header-logo > span {
  font-size: 28px;
  font-weight: 700;
}

.el-container {
  height: 100vh !important;
}

.el-aside {
  background-color: #ffffff;
  color: #333;
  height: 100vh;
}




</style>